Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: Loop internal node error did not terminate workflow

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 16, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 16, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

return None
return current_result
except Exception as e:
# 添加节点
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has a few areas that can be improved:

  1. Handling None Results: It's not clear what should happen when result is None. This could lead to unexpected behavior if called from elsewhere in the code.

  2. Unfinished Try-Catch Block: The try-catch block starts with an import statement but ends without closing it, which might be unintentional or part of another script fragment.

  3. Return Statement Location: The function returns immediately after trying to process results, even if there are errors or other conditions like status 500. This approach does not handle all cases properly; additional error handling logic would make more sense.

Here’s a revised version of the function with some improvements:

@@ -471,6 +471,8 @@ def hand_event_node_result(self, current_node, node_result_future):
             current_node.node_chunk.add_chunk(chunk)
         else:
             result = list(result)
+        
+        # Check for specific status codes or conditions before returning
+        if current_node.status == 500:
+            return None
        
        return current_result

     except Exception as e:
         # Add nodes and log exceptions here (if needed)

Key Changes:

  • Added a comment explaining why we're listing the result.
  • Moved the check for current_node.status == 500 outside the main processing loop, allowing for more robust error handling.
  • Maintained the return statement inside the try-except block to ensure proper context for exception handling.

@shaohuzhang1 shaohuzhang1 merged commit fadd6a6 into v2 Dec 16, 2025
3 of 6 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow_loop branch December 16, 2025 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants